package com.hqyj.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * @Description
 * @Autor 伍军
 * @Date 2022/9/22 9:16
 * @Version 1.0
 **/
@RestController
@RequestMapping("/test")
public class TestAjaxController {

    //get请求
    @GetMapping("/ajaxGet")
    public String ajaxGet(String name, HttpSession session){
        System.out.println("name="+name);
        session.setAttribute("info","444");
        return "hello";
    }
    //post请求
    @PostMapping("/ajaxPost")
    public String ajaxPost(String name, HttpSession session){
        System.out.println("name="+name);
        System.out.println("info="+session.getAttribute("info"));
        return "hello";
    }
}
